﻿using MediaPortal.Configuration;
using OpenSocialPlugin.General;

namespace OpenSocialPlugin.Providers.Sites.Flickr
{
    public class SiteSettings : SiteSettingsBase
    {

        public void Load()
        {
            using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
            {
                this.User = xmlreader.GetValueAsString("opensocial", "FlickrUser", "");
                this.Password = xmlreader.GetValueAsString("opensocial", "FlickrPassword", "");
                this.Enabled = xmlreader.GetValueAsBool("opensocial", "FlickrEnabled", true);
            }
        }

        public void Save()
        {
            using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
            {
                xmlwriter.SetValue("opensocial", "FlickrUser", this.User);
                xmlwriter.SetValue("opensocial", "FlickrPassword", this.Password);
                xmlwriter.SetValueAsBool("opensocial", "FlickrEnabled", this.Enabled);
            }
        }
    }
}
